<?php
class Course {
    private $code;   // 课程代码
    private $name;   // 课程名称
    private $credits;// 学分

    // 构造函数，所有属性为可选
    public function __construct($code = null, $name = null, $credits = null) {
        $this->code = $code;
        $this->name = $name;
        $this->credits = $credits;
    }

    // 获取课程代码
    public function getCode() {
        return $this->code;
    }

    // 获取课程名称
    public function getName() {
        return $this->name;
    }

    // 获取学分
    public function getCredits() {
        return $this->credits;
    }
}
?>